package TestList;

import java.util.ArrayList;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * List存储对象练习
 * User: 86184
 * Date: 2023-10-10
 * Time: 11:24
 */
public class TestList2 {
    public static void main(String[] args) {
        List<Teacher> t = new ArrayList<>();

        t.add(new Teacher("文博","javaSE",'男'));
        t.add(new Teacher("张三","javaSE",'女'));
        t.add(new Teacher("豪杰","MySQL",'男'));
        t.add(new Teacher("波比","体育",'男'));
        t.add(new Teacher("李四","英语",'女'));
        t.add(new Teacher("张6","英语",'女'));

        //打印
        for(Teacher x:t){
            System.out.println(x);
        }
        System.out.println("________________________________");

        //SE
        for(Teacher x:t){
            if(x.getCourse().equals("javaSE")){
                System.out.println(x);
            }
        }
        System.out.println("________________________________");

        //女老师个数
        int c = 0;
        for(Teacher x:t){
            if(x.getSex().equals('女')){
               c++;
            }
        }
        System.out.println("女老师个数："+c);
        System.out.println("________________________________");

        //SE男老师
        for(Teacher x:t){
            if(x.getCourse().equals("javaSE") && x.getSex().equals('男')){
                System.out.println(x);
            }
        }
        System.out.println("________________________________");

        //张
        for(Teacher x:t){
            /**if(x.getName().startsWith("张")){
                System.out.println(x);
            }*/

            if(x.getName().indexOf('张') == 0){
                System.out.println(x);
            }
        }

    }
}
